package javabase.collection.list;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;

public class VectorDemo {
	public static void main(String[] args) {
		List<String> list = null;
		
		// 不支持Enumeration输出
//		list = new ArrayList<String>();
		
		// 既可以用Enumeration也可以用Iterator
		list = new Vector<String>();
		list.add("nihao");
		List<String> list1 = null;
		list1 = new ArrayList<String>();
		list1.add("ooo");
		list1.add(0,"ppp");
		list.addAll(list1);
//		Enumeration<String> enume = ((List<String>)list).elements();
		Enumeration<String> enume = ((Vector<String>)list).elements();
		while (enume.hasMoreElements()) {
			System.out.print(enume.nextElement());
			if(enume.hasMoreElements()) {
				System.out.print("、");
			}
		}
		System.out.println("\n");
		Iterator<?> iter = list.iterator();
		while(iter.hasNext()) {
			System.out.print(iter.next());
			if(iter.hasNext()) {
				System.out.print("、");
			}
		}
	}
}
